import flask
from flask import Flask

# from gevent import pywsgi
import logging

logging.disable()

app = Flask(__name__)


def fib3(n):
    if not isinstance(n, int) or n < 1:
        return None
    lib_seq = [1, 1]
    if n <= 2:
        return lib_seq[: n - 1]
    for i in range(n - 2):
        lib_seq.append(lib_seq[-1] + lib_seq[-2])
    return lib_seq


@app.route("/test_flask", methods=["GET"])
def test_flask():
    a = fib3(5150)
    return {"data": a[:200]}


# if __name__ == '__main__':
#     # app.run(port=9897, host="0.0.0.0")
#     server = pywsgi.WSGIServer(('0.0.0.0', 9897), app)
#     server.serve_forever()
